<html>
<head><meta charset="utf-8"><title>nixos · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html">nixos</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="163890567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/163890567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#163890567">(Apr 22 2019 at 08:10)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> I've just started using NixOS. I'd tried it one or two times before but didn't have the time to sink into working it all out. Do you have a <code>shell.nix</code> you use w/ rustc? I've thrown together something basic but it's probably solving things in less-than-idiomatic ways.</p>
<p>For example, I found that unless I set <code>LD_LIBRARY_PATH="./build/x86_64-unknown-linux-gnu/stage1/lib";</code> then running (a stage1) rustc manually wouldn't find the standard library.</p>



<a name="163893612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/163893612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#163893612">(Apr 22 2019 at 09:27)</a>:</h4>
<p>For me <code>python x.py</code> "just" works, I don’t really fiddle with manually launching <code>stage1</code> any more</p>



<a name="163893618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/163893618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#163893618">(Apr 22 2019 at 09:27)</a>:</h4>
<p>for general rust development I just use the rust overlay <a href="https://github.com/mozilla/nixpkgs-mozilla/blob/master/rust-overlay.nix" target="_blank" title="https://github.com/mozilla/nixpkgs-mozilla/blob/master/rust-overlay.nix">https://github.com/mozilla/nixpkgs-mozilla/blob/master/rust-overlay.nix</a></p>



<a name="163893709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/163893709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#163893709">(Apr 22 2019 at 09:29)</a>:</h4>
<p>Thanks, I'd seen that but hadn't had to use it yet.</p>



<a name="163923305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/163923305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexey Shmalko <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#163923305">(Apr 22 2019 at 17:59)</a>:</h4>
<p>Here is my <code>default.nix</code> I use for rustc: <a href="https://gist.github.com/rasendubi/2f5e6fc9f74295d518556c34c2f995b2" target="_blank" title="https://gist.github.com/rasendubi/2f5e6fc9f74295d518556c34c2f995b2">https://gist.github.com/rasendubi/2f5e6fc9f74295d518556c34c2f995b2</a></p>



<a name="164237753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164237753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164237753">(Apr 26 2019 at 06:55)</a>:</h4>
<p><code>env NIX_AFFINITY_HACK=0 SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt nix-shell -E 'with import&lt;nixpkgs&gt;{};clangStdenv.mkDerivation{name="name";hardeningDisable=["all"];buildInputs=[ccache cmake fish file gdb libedit libxml2 ncurses ninja python27 ripgrep swig which];}' --run fish</code></p>



<a name="164237754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164237754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164237754">(Apr 26 2019 at 06:55)</a>:</h4>
<p>this is what I use</p>



<a name="164237757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164237757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164237757">(Apr 26 2019 at 06:55)</a>:</h4>
<p>this allows building even <code>lldb</code></p>



<a name="164237810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164237810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164237810">(Apr 26 2019 at 06:56)</a>:</h4>
<p>the <code>-E</code> string you can put in a <code>default.nix</code> file, if you want it to be nicer than my lazy setup</p>



<a name="164237823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164237823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164237823">(Apr 26 2019 at 06:56)</a>:</h4>
<p>whoa, I didn't realize <code>pkgs.mkShell</code> was a thing o_O</p>



<a name="164237901"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164237901" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164237901">(Apr 26 2019 at 06:58)</a>:</h4>
<p>oh yeah and my variant builds LLVM with <code>clang</code>, specifically</p>



<a name="164237904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164237904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164237904">(Apr 26 2019 at 06:58)</a>:</h4>
<p>I don't think I managed to ever get GCC to work, lol</p>



<a name="164237915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164237915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164237915">(Apr 26 2019 at 06:58)</a>:</h4>
<p>the <code>LD_LIBRARY_PATH</code> problem is not specific to NixOS AFAIK</p>



<a name="164237944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164237944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164237944">(Apr 26 2019 at 06:59)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> you can install <code>rustup</code>, which 1. does automatic patching of downloaded binaries for you 2. works great for using a locally-built toolchain</p>



<a name="164238063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164238063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164238063">(Apr 26 2019 at 07:02)</a>:</h4>
<p>I never bothered to set up using rustup toolchains for my local builds, maybe I should.</p>



<a name="164238097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164238097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164238097">(Apr 26 2019 at 07:02)</a>:</h4>
<p>yeah it's trivial nowadays :D</p>



<a name="164238105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164238105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164238105">(Apr 26 2019 at 07:02)</a>:</h4>
<p><code>nix-env -i rustup</code> followed by <code>rustup toolchain link rust-1-stage1 /home/eddy/Projects/rust-1/build/x86_64-unknown-linux-gnu/stage1</code></p>



<a name="164238137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164238137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164238137">(Apr 26 2019 at 07:03)</a>:</h4>
<blockquote>
<p>oh yeah and my variant builds LLVM with <code>clang</code>, specifically</p>
</blockquote>
<p>I’ve been experimenting with this recently and had to go through a lot of effort to make the clang that was built could find the standard library headers (since the locally built clang wouldn’t have been wrapped).</p>



<a name="164238192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164238192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164238192">(Apr 26 2019 at 07:04)</a>:</h4>
<p>What does <code>NIX_AFFINITY_HACK</code> do?</p>



<a name="164238260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164238260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164238260">(Apr 26 2019 at 07:06)</a>:</h4>
<p>I’ve also been having a single spurious run-pass failure (I forget the test name off-hand) since switching my build server to NixOS. I’ve been able to safely ignore it so far since none of my changes have affected that test. It fails with a stack overflow I believe.</p>



<a name="164238287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164238287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164238287">(Apr 26 2019 at 07:06)</a>:</h4>
<p>I have no failures over here</p>



<a name="164238291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164238291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164238291">(Apr 26 2019 at 07:06)</a>:</h4>
<p>it could be an <code>ulimit</code> thing</p>



<a name="164238297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164238297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164238297">(Apr 26 2019 at 07:06)</a>:</h4>
<p><code>NIX_AFFINITY_HACK</code>... works around... something</p>



<a name="164238316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164238316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164238316">(Apr 26 2019 at 07:07)</a>:</h4>
<p><a href="https://github.com/NixOS/nix/issues/2359" target="_blank" title="https://github.com/NixOS/nix/issues/2359">https://github.com/NixOS/nix/issues/2359</a></p>



<a name="164238317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164238317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164238317">(Apr 26 2019 at 07:07)</a>:</h4>
<p>oh</p>



<a name="164238318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164238318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164238318">(Apr 26 2019 at 07:07)</a>:</h4>
<p>can I just remove it?</p>



<a name="164238322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164238322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164238322">(Apr 26 2019 at 07:07)</a>:</h4>
<p>I'm not using <code>nix run</code> lol</p>



<a name="164238399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164238399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164238399">(Apr 26 2019 at 07:09)</a>:</h4>
<p>I’ve been using <a href="https://github.com/target/lorri" target="_blank" title="https://github.com/target/lorri">lorri</a> instead of <code>nix-shell</code> because that integrates with direnv and lets me avoid needing to manually add <code>zsh</code> to the <code>shell.nix</code> but also makes the project a gc root so I can run the garbage collection regularly without worrying about removing my development environment packages if I ever need to work offline and can’t download them.</p>



<a name="164238410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164238410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164238410">(Apr 26 2019 at 07:09)</a>:</h4>
<p>I wasn’t aware of <code>nix run</code>.</p>



<a name="164238419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164238419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164238419">(Apr 26 2019 at 07:09)</a>:</h4>
<p>lorri is written in Rust which is also nice.</p>



<a name="164302471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164302471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexey Shmalko <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164302471">(Apr 26 2019 at 22:18)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> I think you don't need <code>SSL_CERT_FILE</code> hack either.<br>
<a href="https://github.com/NixOS/nixpkgs/issues/13744" target="_blank" title="https://github.com/NixOS/nixpkgs/issues/13744">https://github.com/NixOS/nixpkgs/issues/13744</a></p>



<a name="164334690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164334690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164334690">(Apr 27 2019 at 13:00)</a>:</h4>
<p>huh</p>



<a name="164334694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164334694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164334694">(Apr 27 2019 at 13:00)</a>:</h4>
<p>I can try removing it, I guess</p>



<a name="164334711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/nixos/near/164334711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/nixos.html#164334711">(Apr 27 2019 at 13:01)</a>:</h4>
<p>that would make it possible to use mostly just a <code>default.nix</code> with <code>nix-shell</code></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>